<template>
  <div class="search">
    <el-form label-width="80px" size="large" :model="searchForm" ref="formRef">
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="部门名称" prop="name">
            <el-input v-model="searchForm.name" placeholder="请输入你的部门名称"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item prop="leader" label="部门领导">
            <el-input v-model="searchForm.leader" placeholder="请输入你的部门领导"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="创建时间" prop="createAt">
            <el-date-picker
              v-model="searchForm.createAt"
              placeholder="请选择创建日期"
              type="daterange"
              start-placeholder="开始时间"
              end-placeholder="结束时间"
              range-separator="-"
            />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="btns">
      <el-button icon="Refresh" @click="handlerResetClick">重置</el-button>
      <el-button icon="Search" type="primary" @click="handlerQueryClick">查询</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue'
import type { ElForm } from 'element-plus'
const searchForm = reactive({
  name: '',
  leader:'',
  createAt: ''
})

// 重置操作
const formRef = ref<InstanceType<typeof ElForm>>()
function handlerResetClick() {
  formRef.value?.resetFields()
}

function handlerQueryClick(){
  console.log('1111',searchForm)
}
</script>

<style scoped lang="less">
.search {
  padding: 20px;
  background-color: #fff;
  .el-form-item {
    padding: 20px 30px;
  }
}
.btns {
  text-align: right;
  padding: 0 50px 10px 0;
  .el-button {
    height: 36px;
  }
}
</style>
